<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../../js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        $(function (){
            // $("#btn").toggle(function (){
            //     $("#myDiv").css("background","green")
            // },function (){
            //     $("#myDiv").css("background","pink")
            // });

            $("#btn").bind("click mouseover",function (event){
                console.log(event)
                if (event.type == "click"){
                    alert("dianji")
                }else if(event.type == "mouseover"){
                    alert("xuanfu")
                }
            })
        })
        

    </script>
</head>
<body>

    <input id="btn" type="button" value="事件切换">
    <div id="myDiv" style="width:300px;height:300px;background:pink">
        点击按钮变成绿色，再次点击红色
    </div>
</body>
</html>

